/**
 *
 * © Bahadir Zeren 2011
 * bzeren@gmail.com
 * No warranties, express or implied, are made for this program.
 *
 */

package org.baatar.net.test;

import org.baatar.net.message.IResponse;

/**
 * Math operation response class.
 * 
 * @author b_zeren
 */
public class Response<Double> implements IResponse<Double> {

    private Double result = null;
    private Exception exception = null;

    /**
     * Generates a Response object with the passed result value.
     * 
     * @param result result value of math operation to be sent to Client.
     * 
     * @return Response generated Response instance.
     */
    public Response(Double result) {
        this.result = result;
    }

    /**
     * Generates a Response object with the exception.
     * 
     * @param ex exception information to be sent to Client.
     * 
     * @return Response generated Response instance.
     */
    public Response(Exception ex) {
        this.exception = ex;
    }

    /**
     * Result of math calculation.
     * 
     * @return Double return value of the math calculation.
     */
    @Override
    public Double getResult() {
        return result;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Exception getException() {
        return exception;
    }

}
